package com.leyou.second.controller;

import com.leyou.order.dto.OrderDTO;
import com.leyou.second.service.SecondService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author HZN
 * @Date 2020/11/19
 */
@RestController
public class SecondController {
    @Autowired
    private SecondService secondService;

    /**
     * 创建订单
     */
    @PostMapping("/second")
    public ResponseEntity<Long> buildOrder(@RequestBody OrderDTO orderDTO){
        Long orderId = secondService.buildOrder(orderDTO);
        return ResponseEntity.ok(orderId);
    }
}
